An OpenFlow (OpenFlow) network includes an OpenFlow switch (OpenFlow Switch) and a control server (Controller). The OpenFlow switch may locally maintain a flow table (Flow Table). If a to-be-forwarded packet has a corresponding entry in the flow table, quick forwarding is directly performed according to the corresponding entry; if there is no corresponding entry in the flow table, the packet is sent to the control server to determine a transmission path, the control server delivers the flow table to the OpenFlow switch after determining the transmission path, and the OpenFlow switch performs forwarding according to the flow table delivered by the control server.
The flow table may include one or more flow entries, and each flow entry is used for packet matching and includes a match field (match field), an instruction set (instructions), and the like. When a field of a received packet matches content in the match field, the OpenFlow switch performs processing according to an action (action) in the instruction set. For example, the OpenFlow switch forwards the packet to a specified output port, drops the packet, modifies a packet header, or forwards the packet to a group table.
Generic flow processing implements atomic processing on a forwarding plane independent of a specific protocol format, the OpenFlow switch can compare a value of any bit field in the received packet with a preset value, and if the value of the bit field is equal to the preset value, the matching succeeds. To designate any bit field in the packet, four parameters, namely, offset (offset), size (size), bit mask (mask), and data (data) are used to describe features of a bit field used for matching. The offset indicates an amount of offset, which is counted from a start position of a packet frame received through an inbound port of the switch; the size indicates a size of consecutive bits following the offset, and the offset and the size jointly designate a continuous bit field of a determined size together in a data packet; and the mask indicates a bit mask within the bit field designated by the offset and the size, and designates bits within the bit field that are involved in a matching operation. A size of the mask is a size of a size byte, the mask is optional, and if the mask is not included, it indicates that a designated entire bit field is used as a bit field used for matching; and the data indicates a value that the bit field used for matching needs to hold. Exemplarily, a process of implementing generic matching is as follows: A generic matching flow entry is added to a flow table of the OpenFlow switch, where the generic matching flow entry includes offset, size, mask, and data. When the OpenFlow switch receives the data packet, if a value of a bit field designated in the packet according to the offset, the size, and the mask is equal to a value of the data, matching succeeds, and then the OpenFlow switch may perform a subsequent operation according to an action (action) designated in the flow entry.
The foregoing offset and size may be referred to as a prefix, and the offset, the size, and the mask may also be referred to as a prefix. That is, a prefix includes the offset and the size, or includes the offset, the size, and the mask.
In practice, processing efficiency of generic matching is relatively low.